{if $mode=="Remove"}
  {assign var='disabled' value="disabled=\"disabled\""}
{else}
  {assign var='disabled' value=""}
{/if}
  <div class="TEFH">
    <fieldset>
    <legend>Basic Info</legend>
    <p><label for="tablename">Table Name</label>
      <input type="text" name="tablename" id="tablename" value="{$tablename}" {$disabled} />
    </p>
    <p><label for="comments">Comments</label>
      <input type="text" name="comments" id="comments" value="{$comments}" {$disabled} />
    </p>
    </fieldset>
  </div>
  
  <div class="TEFB">
    <fieldset>
    <legend>Columns</legend>
    <table id="columns">
      <thead>
        <tr>
          <th style="background: #FFFFFF;" width="20">&nbsp;</th>
          <th scope="col">Name</th>
          <th scope="col" width="100">Type</th>
          <th scope="col">Length</th>
          <th scope="col" width="200">Attributes</th>
          <th scope="col" width="80">Null</th>
          <th scope="col">Default Value</th>
          <th scope="col" width="10" align="center"><div style="text-align: center"><img src="{#AdminRoot#}common/images/icons/table_auto_increment.png" width="16" height="16" alt="Auto Increment" /></div></th>
          <th scope="col" width="80">Key</th>
          <th scope="col" width="10"><div style="text-align: center"><img src="{#AdminRoot#}common/images/icons/page_white_text.png" width="16" height="16" alt="FullText" /></div></th>
          <th width="77">&nbsp;</th>
        </tr>
      </thead>
      
      <tbody>
        {section name=col start=0 loop=$colnames|@count}
        {assign var=i value=$smarty.section.col.index}
        <tr id="column{$i}">
          <td align="right">{$i+1}</td>
          <td><input type="text"     name="colnames[{$i}]"       id="colnames[{$i}]"      value="{$colnames[$i]}" {$disabled} size="15"  />                                                                    </td>
          <td><select                name="coltypes[{$i}]"       id="coltypes[{$i}]"      {$disabled} class="SMALL">{html_options values=$_column_types   output=$_column_types   selected=$coltypes[$i]}  </select></td>
          <td><input type="text"     name="collengths[{$i}]"     id="collengths[{$i}]"    value="{$collengths[$i]}" {$disabled} size="15" />                                                                    </td>
          <td><select                name="colattribs[{$i}]"     id="colattribs[{$i}]"    {$disabled} class="SMALL">{html_options values=$_column_attribs output=$_column_attribs selected=$colattribs[$i]}</select></td>
          <td><select                name="colnulls[{$i}]"       id="colnulls[{$i}]"      {$disabled} class="SMALL">{html_options values=$_column_nulls   output=$_column_nulls   selected=$colnulls[$i]}  </select></td>
          <td><input type="text"     name="coldefaults[{$i}]"    id="coldefaults[{$i}]"   value="{$coldefaults[$i]}" {$disabled} size="15" />                                                                   </td>
          <td><input type="checkbox" name="colincrements[{$i}]"  id="colincrements[{$i}]" value="AUTO INCREMENT" {if $colincrements[$i]!=''}checked="checked"{/if} {$disabled}/>                      </td>
          <td><select                name="colkeys[{$i}]"        id="colkeys[{$i}]"       {$disabled} class="SMALL">{html_options values=$_column_keys    output=$_column_keys    selected=$colkeys[$i]}   </select></td>
          <td><input type="checkbox" name="colfulltexts[{$i}]"   id="colfulltexts[{$i}]"  value="FULLTEXT"       {if $colfulltexts[$i]!=''}checked="checked"{/if} {$disabled} />                      </td>
          <td>{if $i > 0 && $mode != "Remove"}<input type="button" onclick="removeRow('{$i}');" value="Remove" class="CANCEL" />{else}&nbsp;{/if}</td>
        </tr>
        {/section}
      </tbody>
      
      <tfoot>
        <tr>
          <td style="background: #FFFFFF;">&nbsp;</td>
          <td colspan="10">&nbsp;</td>
        </tr>
      </tfoot>
    </table>
    
    {if $mode != "Remove"}<p style="padding-left: 1.75em;"><input type="button" onclick="addRow();" value="Add Another Column" /></p>{/if}
    </fieldset>
  </div>
  
  <fieldset>
  <legend onclick="$('TEAO').toggle();">Advanced</legend>
    <div id="TEAO">Advanced options!</div>
  </fieldset>
  
  <div class="TEFF">
    <p><input type="submit" value="{$mode} This Table" /></p>
  </div>
  
  {literal}
  <script language="javascript">
    initTE();
	$('TEAO').hide();
  </script>
  {/literal}